<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
set_html('title','登录系统');
if($_RQ['op']=='get'){
	$return['set']=$this->plugin_setting('setting');
	$return['set']['loginlogo']=tomedia($return['set']['loginlogo']);
	$return['set']['loginbg']=tomedia($return['set']['loginbg']);
	if($_SESSION['os']=='windows'){
		$return['session_id']=session_id();
	}
	$_SESSION['logout_forward']='jy_kexie/login2/';
	$_SESSION['forward_url']='jy_kexie/index/'; 
	$return['forward_url']=base64_encode($_SESSION['forward_url']);
	$return['info']=array('role_id'=>'2');
	$return['roles_type']=$this->roles_type;
	if($_SESSION['uid']){
		unset($_SESSION['uid']);
		unset($_SESSION['role_id']);
		unset($_SESSION['member']);
		exi('','',custom_url('jy_kexie/login2/',true));
	}
	exi($return);
}
if($_RQ['op']=='post'){
	$post=get_postdata();
	if(!$post['password'] || !$post['username']){
		exi('请填写账户名和密码','error');
	}
	if($post['username']!=$return['pluginset']['editname'] || $post['password']!=$return['pluginset']['editpwd']){
		exi('用户名或密码错误','error');
	}
	$_SESSION['uid']=$return['pluginset']['adminid'];
	if(!$_SESSION['uid']){
		exi('管理员UID未设置，不能登录编辑员！','error');
	}
	$_SESSION['role_id']=-1;
	$_SESSION['member']['username']=$user['username'];
	//绝对地址，会刷新页面
	$url='/manage.video/';
	exi('登陆成功!','',custom_url($url,true));
	
}